from litemall.base.base_api import BaseApi


class LiteMallPage(BaseApi):

    def add_goods(self, data):
        add_goods_url = "https://litemall.hogwarts.ceshiren.com/admin/goods/create"
        req = {
            "method": "POST",
            "url": add_goods_url,
            "headers": {"x-litemall-admin-token": self.get_token()},
            "json": data
        }
        r = self.send_api(req)
        return r

    def update_goods(self, data):
        update_goods_url = "https://litemall.hogwarts.ceshiren.com/admin/goods/update"
        req = {
            "method": "POST",
            "url": update_goods_url,
            "headers": {"x-litemall-admin-token": self.get_token()},
            "json": data
        }
        r = self.send_api(req)
        return r

    def delete_goods(self, data):
        delete_goods_url = "https://litemall.hogwarts.ceshiren.com/admin/goods/delete"
        req = {
            "method": "POST",
            "url": delete_goods_url,
            "headers": {"x-litemall-admin-token": self.get_token()},
            "json": data
        }
        r = self.send_api(req)
        return r


